import java.util.Locale;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘远望
 * Date: 2025-03-21
 * Time: 10:20
 */
public class Test {
    //求字符串有几个单词
    public static int countWord(String s){
        int len = s.length();
        if(len == 0){
            return 0;
        }
        int count = 0;
        String[] ss = s.split(" ");
        for (String s2: ss) {
            if(s2.length() != 0){
                count++;
            }
        }
        return count;
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        int ret = countWord(s);
        System.out.println(ret);
    }
    public static String toLowerCase(String s){
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            //判断是不是字符
            if(Character.isLetter(ch)){
                //判断是不是大写
                if(Character.isUpperCase(ch)){
                    ch = (char)(ch + 32);
                }
            }
            stringBuffer.append(ch);
        }
        return stringBuffer.toString();
    }
    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String ret = toLowerCase(s);
        System.out.println(ret);
    }
    //判断回文字符
    public static boolean isNumberAndChar(char ch){
        if(Character.isDigit(ch) || Character.isLetter(ch)){
            return true;
        }
        return false;
    }
    public static boolean isPalindrom(String s){
        s = s.toLowerCase();
        int left = 0;
        int right = s.length() - 1;
        while(left < right){
            while(left < right && !isNumberAndChar(s.charAt(left))){
                left++;
            }
            while(left < right && !isNumberAndChar(s.charAt(right))){
                right--;
            }
            if(s.charAt(left) == s.charAt(right)){
                left++;
                right--;
            }else {
                return false;
            }
        }
        return true;
    }
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        boolean b = isPalindrom(s);
        System.out.println(b);
    }
    //求字符串最后一个单词的长度
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        //方法一：
        /*String[] arr = str.split(" ");
        int len = arr[arr.length - 1].length();
        System.out.println(len);*/
        //方法二：
        int index = str.lastIndexOf(" ");
        int len = str.substring(index + 1).length();
        System.out.println(len);
    }
    //判断字符串第一个只出现一次的字符
    public static int firstUniqChar(String s){
        int[] count = new int[26];
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            count[ch - 'a']++;
        }
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if(count[ch - 'a'] == 1){
                return i;
            }
        }
        return -1;
    }
    public static void main1(String[] args) {
        String s = "abcdacd";
        int ret = firstUniqChar(s);
        System.out.println(ret);
    }
}
